package cn.ad.enumration;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * User: shirongkang
 * Date: 2016/12/7
 * Time: 14:32
 * Desc:
 */
public enum OperatingSystemEnum {
    OPERATING_SYSTEM_OTHER("OPERATING_SYSTEM_OTHER","其它"),//其他操作系统
    OPERATING_SYSTEM_IOS("OPERATING_SYSTEM_IOS","IOS"),//ios系统
    OPERATING_SYSTEM_ANDROID("OPERATING_SYSTEM_ANDROID","Android"),//android系统
    OPERATING_SYSTEM_WINDOWS("OPERATING_SYSTEM_WINDOWS","Windows");//Windows系统
	
	private String value;
    private String description;
    private static java.util.LinkedHashMap<String,String> mappings;
    private static List<Dropdown> list;
    private synchronized static java.util.LinkedHashMap<String,String> getMappings() {
        if (mappings == null) {
            mappings = new java.util.LinkedHashMap<>();
            for (OperatingSystemEnum format : OperatingSystemEnum.values()) {
            	mappings.put(format.value, format.description);
            }
        }
        return mappings;
    }
    public static LinkedHashMap<String,String> getMapping(){
        return getMappings();
    }

    public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	private OperatingSystemEnum(String value, String description) {
        this.description = description;
        this.value = value;
    }
    public String getDescription() {
        return this.description;
    }
    
    public static List<Dropdown> getListModel(){
        return getList();
    }
    
    private synchronized static List<Dropdown> getList() {
        if (list == null) {
            list = new ArrayList<>();
            for (OperatingSystemEnum format : OperatingSystemEnum.values()) {
            	list.add(new Dropdown(format.value, format.description));
            }
        }
        return list;
    }
}